package com.nkzy;

import org.mybatis.generator.api.MyBatisGenerator;
import org.mybatis.generator.config.Configuration;
import org.mybatis.generator.config.xml.ConfigurationParser;
import org.mybatis.generator.internal.DefaultShellCallback;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * Create by 王建烨 on 2022/3/18 12:44
 **/

public class Test {
    public void generator() throws Exception {
        List<String> warnings = new ArrayList<String>();
        boolean overwrite = true;
        File configFile = new File("ssmreverse/generatorConfig.xml");
        ConfigurationParser cp = new ConfigurationParser(warnings);
        Configuration config = cp.parseConfiguration(configFile);
        DefaultShellCallback callback = new DefaultShellCallback(overwrite);
        MyBatisGenerator mbg = new MyBatisGenerator(config, callback,
                warnings);
        mbg.generate(null);
    }
    public static void main(String[] args) throws Exception {
        Test gt = new Test();
        gt.generator();
        System.out.println("OK!");
    }

}
